<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Grid - 网格</title>
		<style type="text/css">
			.container {
				margin-top: 10px;
			}

			#container1 {
				display: grid;
				/* 定义列占宽度 */
				grid-template-columns: 100px 200px 300px;
				/* 定义自动行高 */
				grid-auto-rows: 100px;
			}

			#container2 {
				display: grid;
				grid-template-columns: repeat(2, 2fr 1fr);
				/* 定义自动行高 */
				grid-auto-rows: minmax(100px, auto);
				/* 定义列间隙 */
				grid-gap: 20px;
			}

			#container3 {
				display: grid;
				/* 自动填充，最小宽度200px，最大占1fr */
				grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
				grid-auto-rows: minmax(100px, auto);
				grid-gap: 20px;
			}

			#container4 {
				display: grid;
				grid-auto-rows: minmax(100px, auto);
				grid-gap: 20px;
			}

			#container4 header {
				grid-column: 1/5;
				/* grid-column-start: 1;
				grid-column-end: 5; */
				grid-row: 1;
			}

			#container4 aside {
				grid-column: 1/2;
				grid-row: 2;
			}

			#container4 article {
				grid-column: 2/5;
				grid-row: 2;
			}

			#container4 footer {
				grid-column: 1/5;
				grid-row: 3;
			}

			#container5 {
				display: grid;
				grid-template-columns: 1fr 2fr;
				grid-template-areas:
					"header header"
					"sidebar content"
					"footer footer";
				grid-auto-rows: minmax(100px, auto);
				grid-gap: 20px;
			}

			#container5 header {
				grid-area: header;
			}

			#container5 aside {
				grid-area: sidebar;
			}

			#container5 article {
				grid-area: content;
			}

			#container5 footer {
				grid-area: footer;
			}
		</style>
	</head>
	<body>
		<div id="container1" class="container">
			<div style="background-color: #aaffff;"></div>
			<div style="background-color: #ffff7f;"></div>
			<div style="background-color: #ffaaff;"></div>
		</div>

		<div id="container2" class="container">
			<div style="background-color: #aaffff;"></div>
			<div style="background-color: #ffff7f;"></div>
			<div style="background-color: #ffaaff;"></div>
			<div style="background-color: #ffc4b0;"></div>
		</div>

		<div id="container3" class="container">
			<div style="background-color: #aaffff;"></div>
			<div style="background-color: #ffff7f;"></div>
			<div style="background-color: #ffaaff;"></div>
			<div style="background-color: #ffc4b0;"></div>
			<div style="background-color: #ffc0ca;"></div>
		</div>

		<div id="container4" class="container">
			<header style="background-color: #aaffff;"></header>
			<aside style="background-color: #ffaaff;"></aside>
			<article style="background-color: #ffff7f;"></article>
			<footer style="background-color: #ffc0ca;"></footer>
		</div>

		<div id="container5" class="container">
			<header style="background-color: #aaffff;"></header>
			<aside style="background-color: #ffaaff;"></aside>
			<article style="background-color: #ffff7f;"></article>
			<footer style="background-color: #ffc0ca;"></footer>
		</div>
	</body>
</html>
